<template>
  <div class="addSolicitOpinions-container-padding">
    <div v-if="!isHidden" class="buttonList">
      <el-button type="primary" @click="save">保存为草稿</el-button>
      <el-button type="primary" @click="submit">提交</el-button>
    </div>
    <el-form
      :model="formInline"
      class="form-inline"
      label-width="auto"
      label-position="top"
    >
      <el-form-item
        v-for="(item, index) in addFormList"
        :key="index"
        :label="item.label"
      >
        <!-- input -->
        <el-input
          v-if="item.type === 'input'"
          v-model="formInline[item.prop]"
          placeholder="请输入"
          :disabled="item.isDisabled"
          clearable
        />
        <!-- select -->
        <el-select
          v-if="item.type === 'select'"
          v-model="formInline[item.prop]"
          :filterable="item.isSearch"
          placeholder="请选择"
        >
          <el-option
            v-for="j in item.options"
            :key="j.value"
            :label="j.label"
            :value="j.value"
          />
        </el-select>

        <!-- textarea -->
        <el-input
          v-if="item.type === 'textarea'"
          v-model="formInline[item.prop]"
          placeholder="请输入"
          :rows="4"
          type="textarea"
          clearable
        />
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
  import { ref } from 'vue'

  const formInline = ref({
    content: '',
  })

  const addFormList = ref([
    {
      label: '复审意见:',
      prop: 'content',
      type: 'select',
      options: [
        {
          label: '确认继续有效',
          value: '1',
        },
        {
          label: '修订',
          value: '2',
        },
        {
          label: '废止',
          value: '3',
        },
      ],
    },
    {
      label: '主要理由:',
      prop: 'b',
      type: 'textarea',
    },
    {
      label: '申报单位意见:',
      prop: 'k',
      type: 'textarea',
    },
    {
      label: '公司标准化专业组意见:',
      prop: 's',
      type: 'textarea',
    },
    {
      label: '科技信息部意见:',
      prop: 'd',
      type: 'textarea',
    },
  ])

  const handleUploadSuccess = (data) => {
    console.log(data)
  }
</script>

<style lang="scss" scoped>
  .buttonList {
    display: flex;
    justify-content: end;
    padding-bottom: 20px;
    border-bottom: 1px solid #edeff2;
    margin-bottom: 20px;
  }
</style>
